home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / elk-2_0.lha / elk-2.0 / lib / xt / function.c < prev    next >
C/C++ Source or Header  |  1992-10-06  |  619b  |  30 lines

  1. #include "xt.h"
  2.  
  3. #define MAX_FUNCTIONS            512
  4.  
  5. static Object Functions;
  6.  
  7. int Register_Function (x) Object x; {
  8.     register i;
  9.  
  10.     for (i = 0; i < MAX_FUNCTIONS; i++)
  11.     if (Nullp (VECTOR(Functions)->data[i])) break;
  12.     if (i == MAX_FUNCTIONS)
  13.     Primitive_Error ("too many registered functions");
  14.     VECTOR(Functions)->data[i] = x;
  15.     return i;
  16. }
  17.  
  18. Object Get_Function (i) int i; {
  19.     return VECTOR(Functions)->data[i];
  20. }
  21.  
  22. void Deregister_Function (i) int i; {
  23.     VECTOR(Functions)->data[i] = Null;
  24. }
  25.  
  26. init_xt_function () {
  27.     Functions = Make_Vector (MAX_FUNCTIONS, Null);
  28.     Global_GC_Link (Functions);
  29. }
  30.